import RequestHttp from '@/utils/http'
import {
  SearchParams,
  DeptItem,
  DeptIdParam,
  DeptByIdParams,
  DeptParam,
  VoListItem,
} from './model/deptModel'

enum Api {
  index = '/api/sysDept/index',
  show = '/api/sysDept/show',
  store = '/api/sysDept/store',
  update = '/api/sysDept/update',
  destroy = '/api/sysDept/destroy',
  voList = '/api/sysDept/vo/list',
}

export const getList = (params?: SearchParams) => {
  return RequestHttp.get<DeptItem[]>(Api.index, params)
}

export const store = (params: DeptParam) => {
  return RequestHttp.post<boolean>(Api.store, params)
}

export const deptShow = (params: DeptIdParam) => {
  return RequestHttp.get<DeptItem>(Api.show, params)
}

export const update = (params: DeptParam) => {
  return RequestHttp.put<boolean>(Api.update, params)
}

export const destroy = (params: DeptByIdParams) => {
  return RequestHttp.delete<boolean>(Api.destroy, params)
}

export const getDeptVoList = () => {
  return RequestHttp.get<VoListItem[]>(Api.voList)
}
